from datetime import datetime

from sqlalchemy import Column, Integer, ForeignKey, String, DateTime
from sqlalchemy.orm import relationship, Mapped, mapped_column

from lib.orm.Base import Base


class LoginLog(Base):
    __tablename__ = 'login_log'
    id = Column(Integer, primary_key=True)
    user_id: Mapped[int] = mapped_column(Integer())
    login_ip: Mapped[str] = mapped_column(String(30))
    login_dt = Column(DateTime, default=datetime.now)
    countryCode: Mapped[str] = mapped_column(String(2))
    country: Mapped[str] = mapped_column(String(64))
    districts: Mapped[str] = mapped_column(String(16))
    city: Mapped[str] = mapped_column(String(16))
    province: Mapped[str] = mapped_column(String(16))
    isp: Mapped[str] = mapped_column(String(16))